package com.daohang.dh.service.impl;

import com.daohang.dh.entity.MidpMarkTagEntity;
import com.daohang.dh.service.MidpMarkTagService;
import com.daohang.dh.manager.MidpMarkTagManager;
import net.chenlin.dp.common.entity.Page;
import net.chenlin.dp.common.entity.Query;
import net.chenlin.dp.common.entity.R;
import net.chenlin.dp.common.utils.CommonUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * 数据标签对应表
 *
 * @author xiaomei
 * @email yczclcn@163.com
 * @url www.chenlintech.com
 * @date 2018/05/23
 */
@Service("midpMarkTagService")
public class MidpMarkTagServiceImpl implements MidpMarkTagService {

	@Autowired
	private MidpMarkTagManager midpMarkTagManager;

	@Override
	public Page<MidpMarkTagEntity> listMidpMarkTag(Map<String, Object> params) {
		Query query = new Query(params);
		Page<MidpMarkTagEntity> page = new Page<>(query);
		midpMarkTagManager.listMidpMarkTag(page, query);
		return page;
	}

	@Override
	public R saveMidpMarkTag(MidpMarkTagEntity role) {
		int count = midpMarkTagManager.saveMidpMarkTag(role);
		return CommonUtils.msg(count);
	}

	@Override
	public R getMidpMarkTagById(Long id) {
		MidpMarkTagEntity midpMarkTag = midpMarkTagManager.getMidpMarkTagById(id);
		return CommonUtils.msg(midpMarkTag);
	}

	@Override
	public R updateMidpMarkTag(MidpMarkTagEntity midpMarkTag) {
		int count = midpMarkTagManager.updateMidpMarkTag(midpMarkTag);
		return CommonUtils.msg(count);
	}

	@Override
	public R batchRemove(Long[] id) {
		int count = midpMarkTagManager.batchRemove(id);
		return CommonUtils.msg(id, count);
	}

}
